package com.r2coding.exception;

import com.r2coding.enums.AuthResultEnum;
import com.r2coding.enums.ServiceResultEnum;
import lombok.Data;

/**
 * @author: 98k灬
 * @since: 2022/10/31
 * @email: 98k_style@sina.com
 * @公众号: 爪哇Guy灬
 **/
@Data
public class CustomException extends RuntimeException {
    private Integer code;

    public CustomException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public CustomException(String message) {
        super(message);
    }

    public CustomException(AuthResultEnum result) {
        super(result.getDesc());
        this.code = result.getCode();
    }

    public CustomException(ServiceResultEnum result) {
        super(result.getDesc());
        this.code = result.getCode();
    }
}
